﻿using System;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;

public partial class indexChild : PageBase
{
    //获取上次访问的页
    public int intSubPage = 1;

    public string SubPage = "index_jjjs.aspx";

    protected void Page_Load(object sender, EventArgs e)
    {
        if (_Customer != null)
        {
            if (_Customer.Competences.CompetencesList != "")
            {
                SubPage = Shove._Web.Utility.GetRequest("SubPage");
            }
        }
        else
        {
            this.Response.Write("<script language='javascript'>window.top.location.href='" + Shove._Web.Utility.GetUrl() + "/Login.aspx'</script>");

            return;  
        }

        if (SubPage == "index_jjjs.aspx")
        {
            intSubPage = 1;
        }
        else if (SubPage == "index_cwgl.aspx")
        {
            intSubPage = 2;
        }
        else if (SubPage == "index_jxc.aspx")
        {
            intSubPage = 3;
        }
        //else if (SubPage == "index_bbcx.aspx")
        //{
        //    intSubPage = 4;
        //}
        else if (SubPage == "index_scwd.aspx")
        {
            intSubPage = 5;
        }
        else if (SubPage == "index_xtsz.aspx")
        {
            intSubPage = 6;
        }

        if (!IsPostBack)
        {
            this.lbUserName.Text = _Customer.CustomerName;
            if (_Customer.Competences[Competences.Administrator])
            {
                this.lbLevel.Text = "管理员";
                this.lbMondil.Text = "站点管理员";
            }
            else
            {                
                this.lbLevel.Text = "会员";
                this.lbMondil.Text = "会员业务";

                if (!_Customer.Competences[Competences.SurrogateR])
                {
                    tdSCWD.Visible = false;
                }
            }

            labCompanyName.Text = _Site.ShopName;
        }
    }

    #region Web 窗体设计器生成的代码

    override protected void OnInit(EventArgs e)
    {
        isRequestLogin = true;

        RequestLoginPage = "index.aspx";

        base.OnInit(e);
    }

    #endregion

    protected void lbExit_Click(object sender, EventArgs e)
    {
        this.Session.RemoveAll();

        this.Response.Write("<script language=javascript>window.top.document.location.href='Login.aspx';</script>");
    }

}